/**
 * Aibton.com Inc.
 * Copyright (c) 2004-2017 All Rights Reserved.
 */
package com.aibton.mybatis.share.utils;

/**
 * 分表工具类，设置表后缀
 * @author huzhihui
 * @version v 0.1 2017/6/5 21:10 huzhihui Exp $$
 */
public class MyBatisShareUtils {

    /**
     * 设置分表后缀，优先级最高
     * @param supperShareTableSuffix
     */
    public static void setSupperShareTableSuffix(String supperShareTableSuffix) {
        MybatisShareThreadLocalHolder.setAllowMybatisShare(true);
        MybatisShareThreadLocalHolder.setShareTableSuffix(supperShareTableSuffix);
    }

    /**
     * 获取分表后缀，优先级最高
     * @return
     */
    public static String getSupperShareTableSuffix() {
        return MybatisShareThreadLocalHolder.getSupperShareTableSuffix();
    }

    /**
     * 设置分表后缀，优先级最低
     * @param shareTableSuffix
     */
    public static void setShareTableSuffix(String shareTableSuffix) {
        MybatisShareThreadLocalHolder.setAllowMybatisShare(true);
        MybatisShareThreadLocalHolder.setShareTableSuffix(shareTableSuffix);
    }

    /**
     * 获取分表后缀，优先级最低
     * @return
     */
    public static String getShareTableSuffix() {
        return MybatisShareThreadLocalHolder.getShareTableSuffix();
    }

    /**
     * 清除分表信息
     */
    public static void clear() {
        MybatisShareThreadLocalHolder.clear();
    }
}
